package com.yima.baseproj.module.app.goods;


import com.yima.baseproj.module.app.tongzhi.model.AppTongzhiSearchModel;
import com.yima.baseproj.module.sys.goods.GoodsEntity;
import com.yima.baseproj.module.sys.goods.GoodsService;
import com.yima.baseproj.security.SecurityUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Api(tags = "小程序商品管理")
@RestController
@RequestMapping("/api/app/goods")
public class AppGoodsController {

    @Autowired
    private GoodsService goodsService;

    @ApiOperation("查询商品列表")
    @GetMapping(value = "/findAllByList")
    public Object findAllByList(GoodsEntity goods) {
        List<Map> list = goodsService.findByList(goods);
        return list;
    }


    @ApiOperation("根据id查询产品信息")
    @GetMapping("/findById/{goodsId}")
    public GoodsEntity findById(@PathVariable int goodsId){
        GoodsEntity goodsEntity = goodsService.findById(goodsId);
        return goodsEntity;
    }

}
